package com.poly;

public class Test {
    public static void main(String[] args) {
        // 向上转型
        Base base = new Sub();
        System.out.println(base.count);  // 看编译类型 10

        Sub sub = new Sub();
        System.out.println(sub.count);  // 看编译类型 20
    }
}

class Base {
    int count = 10;

    public void show() {
        System.out.println("Base");
    }
}

class Sub extends Base {
    int count = 20;

    public void show() {
        System.out.println("Sub");
    }
}